from twisted.internet.protocol import Protocol
import time

class Connection:
    protocol = None
    player = None
    def __init__(self, _protocol):
        self.protocol = _protocol
        
    def login(self, _player):
        '''Called when a player has successfully logged in'''
        self.player = _player
        
    def logout(self):
        '''Called when a connection is lost due to network troubles or player logout'''
        pass
    
class Player:
    name = "Default"
    uid = 0
    connect_time = 0
    
    def __init__(self, _name):
        self.name = _name
        self.connect_time = time.time()
        
    def connectedTime(self):
        return time.time() - self.connect_time